Skip to content

Skip unwritable IRQs instead of failing - #280

Merged
vstinner merged 1 commit into
psf:mainfrom
mgree:irq-affinity-eperm
Nov 24, 2026
Merged

vstinner merged 1 commit into
psf:mainfrom
mgree:irq-affinity-eperm

Conversation

@mgree

@mgree mgree commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Since Linux 6.12, some IRQs are read-only, i.e., they can't be moved from CPU to CPU. When pyperf encounters these, it fails (EPERM), when I think they should simply be ignored. (On my laptop, these IRQs correspond to my NVMe drive.) This has been true since 2024 (LKML).

I can imagine giving a warning of some kind, but it's not an actionable warning... so probably not worth it.

(Hopefully my last PR today... my laptop is somehow not a configuration pyperf expects!)

@vstinner

Copy link
Copy Markdown
Member

I confirm that I have a bunch of IRQ which cannot be written on Fedora 45 with the Linux kernel 7.3 (7.3.4-300.fc45.x86_64):

$ ls /proc/irq/*/smp_affinity -l|grep -v 'rw-r--r--'|sort -n
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/133/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/134/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/135/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/136/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/137/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/138/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/139/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/140/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/142/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/143/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/144/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/145/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/188/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/189/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/190/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/191/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/192/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/193/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/194/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:58 /proc/irq/195/smp_affinity
-r--r--r--. 1 root root 0 Nov 24 01:59 /proc/irq/2/smp_affinity

@vstinner

vstinner commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

I tested with 2 isolated CPUs (on 12 logical CPUs in total): isolcpus=5,11 rcu_nocbs=5,11 in /proc/cmdline.

Without this change, sudo python -m pyperf system tune fails with:

Errors
======

IRQ affinity: Failed to write '000007df' into /proc/irq/2/smp_affinity: [Errno 1] Operation not permitted

I confirm that only IRQ 1 is modified, the code stops at IRQ 2 since it hits a permission error.

With this change, the SMP mask is set on all IRQs successfully:

Actions
=======

(...)
IRQ affinity: Set default affinity to CPU 0-4,6-10
IRQ affinity: Set affinity of IRQ 0-1,3-16,120-125,141,146-149,171,173-187,196 to CPU 0-4,6-10
(...)

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vstinner
vstinner merged commit 275dbb7 into psf:main Nov 24, 2026
13 checks passed
@vstinner

Copy link
Copy Markdown
Member

Merged. Thanks for the fix! I saw that error before, but I never paid much attention to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants